import org.apache.commons.io.IOUtils
import org.apache.commons.fileupload.util.Streams
import org.apache.commons.fileupload.servlet.ServletFileUpload
import java.io.*;
import com.google.appengine.api.images.* 
import com.pobos.model.*
import com.google.appengine.api.datastore.*
import static com.google.appengine.api.datastore.FetchOptions.Builder.*


	 
 def items = obtenItems()
 amosaItems(items)
 //request.items = obtenItems()
 //forward '/admin/listaItems.gtpl'


def obtenItems() {
	
	def query = new Query("Item")
	 
	//query.addSort("numeroItems", Query.SortDirection.DESCENDING)
	//query.addFilter("numeroItems", Query.FilterOperator.GREATER_THAN, 0)
	 
	PreparedQuery preparedQuery = datastore.prepare(query)
	 
	def entities = preparedQuery.asList( withLimit(50) )
	
	
}   


def amosaItems(def items) {
	
	html.ul {
		items.each {item->
			li {
				span class:"tipo","$item.tipo"
				span class:"id" {
					a href:"/admin/verItem.groovy?id=${item.key?.id}","${item.key?.id}"
				}
			}
		}
	}
	
	
}



